package Modele; 

import java.io.FileNotFoundException;
import java.io.*;
import java.util.Scanner;

public class FichierContact {
	
	private InputStream file = null;
	private Scanner sc;
	
	public FichierContact() throws FileNotFoundException{
		try {
            load("src/contacts.csv");
		} catch (FileNotFoundException e) {
			
			e.printStackTrace();
		}
	}
	
	public void load() throws FileNotFoundException{
		if(file==null){
			file = new FileInputStream("src/contacts.csv");
			sc = new Scanner(file);
             }
     }
	public FichierContact(InputStream f) throws FileNotFoundException{
		file=f;
		sc = new Scanner(file);
	}
	
	public void load(String args) throws FileNotFoundException{
		if(file==null){
			file = new FileInputStream(args);
			sc = new Scanner(file);
		}
	}
	
	public String read(){
		return sc.nextLine();
	}
	
	public boolean hasNext(){
		return sc.hasNext();
	}

}
